package com.naiterui.ehp.bs.pharmacist.feign;

import java.util.List;
import java.util.Map;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.naiterui.ehp.bp.bo.esign.DigitalCertificateBO;
import com.naiterui.ehp.bp.bo.esign.EsignDoctorBO;
import com.naiterui.ehp.bp.bo.esign.EsignNoSecretBO;
import com.naiterui.ehp.bp.bo.esign.NoSecretParamBO;
import com.naiterui.ehp.bp.bo.esign.PreSignResultBO;
import com.naiterui.ehp.bp.bo.esign.RecomSignParamBO;
import com.naiterui.ehp.bp.bo.esign.WillTypeBO;
import com.naiterui.ehp.bp.support.config.FeignConfiguration;
import com.naiterui.ehp.bp.support.exception.BusinessException;

/**
 * @Description 调用签名服务
 * @Author gongbaoqiang
 * @Date 2019/12/5 8:28 PM
 */
@FeignClient(name = "pharmacistEsign", url = "${ehp.domain.esign}", configuration = FeignConfiguration.class)
public interface PharmacistEsignFeignClient {

    /**
     * 创建电子签名医生账户
     *
     * @param userId
     *
     * @return
     */
    @PostMapping("inner/pharmacist/esign/ph/add")
    void esignPharmacistAdd(@RequestParam("userId") Long userId, @RequestParam("name") String name, @RequestParam("idCard") String idCard,
                            @RequestParam("phone") String phone,
                            @RequestParam("hospital") String hospital,
                            @RequestParam("sealImagePath") String sealImagePath,
        @RequestParam("authStatus") Integer authStatus, @RequestParam("pwd") String pwd) throws BusinessException;

    /**
     * 生成个人签章图片
     * @param name
     * @return
     * @throws BusinessException
     */
    @PostMapping("inner/common/personal/seal")
    String getPersonalSeal(@RequestParam("name") String name) throws BusinessException;
    /**
     * <pre>
     *     获取预签名unionId
     * </pre>
     *
     * @param bo
     *
     * @return
     *
     * @throws BusinessException
     */
    @PostMapping("/inner/recom/preSign/ph")
    PreSignResultBO getUnionId(@RequestBody RecomSignParamBO bo) throws BusinessException;

    /**
     * 药师签名
     * @throws BusinessException
     */
    @PostMapping("/inner/recom/sign/ph")
    void sign(@RequestBody RecomSignParamBO bo) throws BusinessException;

    /**
     * 获取实名认证验证码
     *
     * @param name
     * @param phone
     * @param idCard
     *
     * @throws BusinessException
     */
    @PostMapping("inner/pharmacist/esign/realname/code")
    void getRealnameCode(@RequestParam("name") String name, @RequestParam("phone") String phone, @RequestParam("idCard") String idCard) throws BusinessException;

    /**
     * 实名认证回填校验
     *
     * @param phone
     * @param code
     *
     * @throws BusinessException
     */
    @PostMapping("inner/pharmacist/esign/realname/check")
    void checkRealnameByCode(@RequestParam("phone") String phone, @RequestParam("code") String code) throws BusinessException;

    /**
     * 更新药师签名图片
     *
     *
     * @throws BusinessException
     */
    @PostMapping("inner/pharmacist/esign/seal/update")
    void updateSealImage(@RequestParam("pharmacistId") Long pharmacistId, @RequestParam("sealImage") String sealImage) throws BusinessException;

    /**
     * 获取医网信签名账号配置
     *
     * @throws BusinessException
     */
    @PostMapping("inner/common/ywx/sign/config")
    Map<String, String> getYwxSignConfig() throws BusinessException;

    /**
     * 意愿签署列表
     * @return
     * @throws BusinessException
     */
    @PostMapping("/inner/pharmacist/will/types")
    List<WillTypeBO> getWillTypes(@RequestParam("pharmacistId") Long pharmacistId) throws BusinessException;

    /**
     * 更新药师意愿签署方式
     * @throws BusinessException
     */
    @PostMapping("/inner/pharmacist/will/type/update")
    void updateWillType(@RequestParam("pharmacistId") Long pharmacistId, @RequestParam("willType") String willType) throws BusinessException;

    /**
     * 更新药师签名密码
     * @param pharmacistId
     * @param password
     * @throws BusinessException
     */
    @PostMapping("/inner/pharmacist/password/update")
    void updatePasswd(@RequestParam("pharmacistId") Long pharmacistId, @RequestParam("password")String password) throws BusinessException;

    /**
     * 获取是否设置免密
     * @param pharmacistId 药师id
     * @return 0.未设置 1.已设置
     * @throws BusinessException
     */
    @GetMapping("/inner/pharmacist/getNoSecret")
    Integer getNoSecret(@RequestParam("pharmacistId") Long pharmacistId) throws BusinessException;

    /**
     * 获取免签信息
     * @param pharmacistId 药师id
     * @return
     * @throws BusinessException
     */
    @GetMapping("/inner/pharmacist/getNoSecretInfo")
    EsignNoSecretBO getNoSecretInfo(@RequestParam("pharmacistId") Long pharmacistId) throws BusinessException;

    /**
     * 设置免密预签署
     *
     * @param pharmacistId
     * @return
     * @throws BusinessException
     */
    @PostMapping("/inner/pharmacist/preNoSecret")
    PreSignResultBO preNoSecret(@RequestParam("pharmacistId") Long pharmacistId) throws BusinessException;

    /**
     * 设置免密
     * 
     * @param paramBO
     * @return
     * @throws BusinessException
     */
    @PostMapping("/inner/pharmacist/setNoSecret")
    void setNoSecret(@RequestBody NoSecretParamBO paramBO) throws BusinessException;

    /**
     * 调配药师处方预签署
     */
    @PostMapping("/inner/recom/preSign/al/ph")
    PreSignResultBO preSignAlPh(@RequestBody RecomSignParamBO bo) throws BusinessException;

    /**
     * 调配药师处方签名
     */
    @PostMapping("/inner/recom/sign/al/ph")
    void signAlPh(@RequestBody RecomSignParamBO bo) throws BusinessException;

    /**
     * 获取药师数字证书
     *
     * @param pharmacistId
     * @return
     * @throws BusinessException
     */
    @GetMapping("inner/pharmacist/getDigitalCertificate")
    DigitalCertificateBO getDigitalCertificate(@RequestParam("pharmacistId") Long pharmacistId)
        throws BusinessException;

    @GetMapping("inner/pharmacist/saveSealImg")
    void saveSealImg(@RequestParam("pharmacistId") Long pharmacistId, @RequestParam("sealImg") String sealImg)
        throws BusinessException;

    /**
     * 根据身份证号和认证状态获取医生身份信息
     * @param idNo
     * @param authStatus
     * @return
     */
    @GetMapping("inner/dr/getAccount")
    EsignDoctorBO getDrAccountByIdNoAndAuthStatus(@RequestParam String idNo, @RequestParam Integer authStatus);

    /**
     * 检查该药师身份证号是否已实名
     *
     * @param pharmacistId
     * @param idCard
     * @throws BusinessException
     */
    @GetMapping("inner/pharmacist/checkPharmacistRealname")
    void checkPharmacistRealname(@RequestParam("pharmacistId") Long pharmacistId, @RequestParam("idCard") String idCard)
        throws BusinessException;
}
